﻿Public Class RjClsAcctDbAccess
    Inherits ClsBaseDbAccess

    Public Sub New(ByVal s As String)
        MyBase.New(s, TABLE_NAME_RJ_ACCT)
    End Sub

    Public Sub New(ByVal s As String, ByVal n As String)
        MyBase.New(s, n)

    End Sub

    Public Overrides Function ConvertRecordToClass(reader As OleDb.OleDbDataReader) As Object

        If reader Is Nothing Then
            Return Nothing
        End If

        Try

            Dim tmpList As List(Of RjClsAccount) = New List(Of RjClsAccount)
            Dim tmpCls As RjClsAccount

            While reader.Read()

                tmpCls = New RjClsAccount()

                With tmpCls
                    .Level = ConvertDbNullInteger(reader(0))  '01
                    .PrevLevelCode = ConvertDbNullString(reader(1))  '02
                    .AccountCode = ConvertDbNullString(reader(2))  '03
                    .AccountName = ConvertDbNullString(reader(3))  '04
                    .FullName = ConvertDbNullString(reader(4))  '05
                    .AccountType = ConvertDbNullString(reader(5))  '06
                    .BalanceDirection = ConvertDbNullInteger(reader(6))  '07
                    .IfLastLevel = reader.GetBoolean(7)  '08
                    .YearMoney = ConvertDbNullDecimal(reader(8))  '09
                    .SpecialName = ConvertDbNullString(reader(9))  '10
                    .YearQuantity = ConvertDbNullSingle(reader(10))  '11
                    .YearCurrency = ConvertDbNullDecimal(reader(11))  '12
                    .IfCashFlow = reader.GetBoolean(12)  '13
                    .CashFlowCode = ConvertDbNullString(reader(13))  '14
                    .IfProject = reader.GetBoolean(14) '15
                    .MonthTransit = ConvertDbNullString(reader(15))  '16
                    .MontTransitAcctCode = ConvertDbNullString(reader(16))  '17
                    .Use = ConvertDbNullString(reader(17))  '18
                    .K1 = reader.GetBoolean(18) '19
                    .K2 = reader.GetBoolean(19) '20
                    .K3 = reader.GetBoolean(20) '21
                    .Abset = ConvertDbNullString(reader(21)) '22
                    .C2 = ConvertDbNullString(reader(22)) '23
                    .C3 = ConvertDbNullString(reader(23)) '24

                End With

                tmpList.Add(tmpCls)

            End While

            Return tmpList

        Catch ex As Exception

            mErrorNumber = -1001
            mErrorMessage = ex.Message
            mErrorCreater = "ClsTVoucherGroupDbAccess - ConvertRecordToClass"

            Return Nothing
        End Try


    End Function
End Class
